def input_password():
    password = input('请输入密码：')
    if len(password) >= 8:
        return password
    #主动抛出异常
    raise Exception("密码长度要大于等于8位")


try:
    password = input_password()
    print(password)
except Exception as e:
    print(f"e的信息 {e}")